﻿#region 版权信息

//  ------------------------------------------------------------------------------
//   Copyright (C) 成都联宇创新科技有限公司 版权所有。 
//   
//   文件名：LotteryConfig.cs
//   文件功能描述：LotteryConfig.cs
//   创建标识：骆智慧 2014/07/16
//   
//   修改标识：
//   修改描述：
//  ------------------------------------------------------------------------------

#endregion

#region 名称空间导入

using System;
using Castle.ActiveRecord;

#endregion

namespace ECity.Domain
{
    /// <summary>
    ///     奖项设置
    /// </summary>
    [Serializable]
    [ActiveRecord(Tables.LotteryConfig)]
    public class LotteryConfig : ActiveRecordBase<LotteryConfig>
    {
        /// <summary>
        ///     编号
        /// </summary>
        [PrimaryKey(PrimaryKeyType.Sequence, SequenceName = Sequences.LotteryConfig)]
        public virtual int ID { get; set; }

        /// <summary>
        ///     奖项
        /// </summary>
        [BelongsTo(Column = "PRIZE_ID", NotNull = true)]
        public virtual LotteryPrize LotteryPrize { get; set; }

        /// <summary>
        ///     奖品数量
        /// </summary>
        [Property("LOTTERY_COUNT", NotNull = true)]
        public virtual int PublishCount { get; set; }

        /// <summary>
        ///     剩余数量
        /// </summary>
        [Property("PRIZE_BLANCE", NotNull = true)]
        public virtual int PrizesBlance { get; set; }

        /// <summary>
        ///     开始时间
        /// </summary>
        [Property("START_DATE", NotNull = true)]
        public virtual DateTime StartDate { get; set; }

        /// <summary>
        ///     结束时间
        /// </summary>
        [Property("END_DATE", NotNull = true)]
        public virtual DateTime EndDate { get; set; }

        /// <summary>
        ///     开奖系数  数字越大表示越难被开出来
        /// </summary>
        [Property("ODDS_COEFFICIENT", NotNull = true)]
        public virtual double OddsCoefficient { get; set; }

        /// <summary>
        ///     是否启用此奖项配置
        /// </summary>
        [Property("IS_ACTIVED", NotNull = true)]
        public virtual int IsActived { get; set; }

        /// <summary>
        ///     所属活动
        /// </summary>
        [BelongsTo(Column = "SWEEPSTAKE_ID", NotNull = true)]
        public virtual LotterySweepstake Sweepstake { get; set; }

        /// <summary>
        ///     是轮空项
        /// </summary>
        [Property("IS_BYE_ITEM", NotNull = true)]
        public int IsByeItem { get; set; }

        /// <summary>
        ///     平衡值
        /// </summary>
        [Property("PROPORTION")]
        public double Proportion { get; set; }

        /// <summary>
        ///     中奖概率
        /// </summary>
        [Property("PROBABILITY")]
        public double Probability { get; set; }

        public override int GetHashCode()
        {
            return Tables.LotteryConfig.GetHashCode() ^ ID;
        }
    }
}